#include <REGX52.H>
#include "LCD1602.h"
#include "DS18B20.h"
#include "Delay.h"

float temp;

void main() {
    DS18B20_Convert();
    Delay(1000);
    LCD_Init();
    LCD_ShowString(1,1,"Temperature:");
    while(1) {
        DS18B20_Convert();
        temp = DS18B20_ReadT();
        if(temp<0) {
            LCD_ShowChar(2,1,'-');
            temp = -temp;
        }
        else {
            LCD_ShowChar(2,1,'+');
        }
        LCD_ShowNum(2,2,temp,3);
        LCD_ShowChar(2,5,'.');
        LCD_ShowNum(2,6,(unsigned long)(temp*10000)%10000,4);
    }
}